<?php

namespace App\Enums;

/**
 * 盘点方案状态
 */
enum InventoryPlanStatus: int
{
    case WAIT_VERIFY    = 0;
    case ALREADY_VERIFY = 1;
    case PUSH_KINGDEE   = 2;

    /**
     * 获取名称
     * @return string
     */
    public function label(): string
    {
        return match ($this) {
            self::WAIT_VERIFY       => "待审核",
            self::ALREADY_VERIFY    => "已审核",
            self::PUSH_KINGDEE      => "推送成功",
        };
    }

    /**
     * 根据值获取名称
     * @param $val
     * @return string
     */
    static function labelBy($val){
        $obj = self::tryFrom((int)$val);
        return $obj ? $obj->label() : '';
    }

}
